<?php
session_start();

include '../dbconnect.php';

$uname = $_REQUEST['username'];
$pwd = $_REQUEST['password'];
$sql = "SELECT * FROM user where U_Username = '".$uname."' and U_Password = '".$pwd."'";
$result = $conn->query($sql);
$uid='';

if ($result->num_rows > 0) {
  while($row = $result->fetch_assoc()) {
    $uid = $row['U_ID'];
	$uname = $row['U_Username'];
	
    $_SESSION['uid'] = $uid;
	$_SESSION['uname'] = $uname;
  }

header("Location: ../user/1_homepage.php?uid=".$uid);
exit;

  }else {
	  
	  
echo '登录失败！';
  }
?>
